package com.xlro.servlet;

import com.xlro.service.BookService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "AlterBookInfoServlet",urlPatterns = "/alterBookInfo")
public class AlterBookInfoServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        String id = req.getParameter("id");
        String name = req.getParameter("name");
        String author = req.getParameter("author");
        String library = req.getParameter("library");
        String sort = req.getParameter("sort");
        String position = req.getParameter("position");
        String status = req.getParameter("status");
        String desc = req.getParameter("desc");

        BookService bookService=new BookService();
        String result = bookService.updateBookById(id, name, author, library, sort, position, status, desc);

        req.getRequestDispatcher("./alterBookInfo.jsp?title="+"提示"+"&message="+result).forward(req,resp);

    }
}
